Recently, an image compression technique represented by the MPEG (Moving Picture Experts Group) has been being developed.
FIG. 1 shows a configuration of a conventional image coding apparatus 1 which uses such MPEG as mentioned above.
Referring to FIG. 1, a macro block division section 11 receives frame data as an input thereto, converts the frame data into data of a macro block (hereinafter referred to as MB), and outputs the data of the MB obtained by the conversion to a subtraction section 19, a quantization scale determination section 18 and a reference image production section 17.
The subtraction section 19 subtracts reference image data inputted from the reference image production section 17 from the data of the MB inputted from the macro block division section 11 (namely, the subtraction section 19 adds the reference image data in the reversed polarity to the data of the MB) and outputs difference data to a DCT section 12.
The DCT section 12 performs a DCT (Discrete Consign Transform) process for the difference data inputted from the subtraction section 19 to convert them into DCT coefficients and outputs the DCT coefficients to a quantization section 13.
The quantization section 13 quantizes the DCT coefficients inputted from the DCT section 12 with a quantization scale inputted from a quantization scale determination section 18 and outputs resulting values to a VLC section 14 and a decoding section 16.
The VLC section 14 performs a variable length coding process for the quantized data inputted from the quantization section 13 to convert the data into a VLC (Variable Length Code) and outputs the VLC to a transmission buffer section 15.
The transmission buffer section 15 outputs the VLC inputted thereto to the quantization scale determination section 18. Meanwhile, the transmission buffer section 15 converts, when the VLCs of the entire frame are inputted thereto, the VLCs into data in a unit of a frame and outputs the data as bit stream data to the outside.
In the decoding section 16, a dequantization section 21 dequantizes the quantized data inputted from the quantization section 13 and outputs resulting data to an inverse DCT section 22.
The inverse DCT section 22 performs an inverse DCT process for the dequantized data inputted from the dequantization section 21 into original image data and outputs the original image data to an addition section 34 of the reference image production section 17.
In the reference image production section 17, the addition section 34 adds image data inputted from the inverse DCT section 22 and reference image data, which is inputted from a motion compensation buffer section 31 and corresponding to the image data, and outputs resulting data to the motion compensation buffer section 31 through a motion compensation section 32.
The motion compensation buffer section 31 stores the image data inputted from the addition section 34 through the motion compensation section 32 as predictive image data for a next frame.
A motion detection arithmetic operation section 33 detects a motion vector corresponding to the MB inputted from the macro block division section 11 and outputs the motion vector to the motion compensation section 32.
The motion compensation section 32 performs a process for motion compensation based on the motion vector inputted from the motion vector arithmetic operation section 33. In particular, the motion compensation section 32 reads out reference image data, which is corresponding to the data of the MB inputted to the subtraction section 19, from among the predictive image data stored in advance in the motion compensation buffer section 31, based on the motion vector inputted from the motion detection arithmetic operation section 33, and outputs the reference image data to the subtraction section 19.
In the quantization scale determination section 18, a complexity arithmetic operation section 46 calculates, based on the VLC inputted from the transmission buffer section 15, a complexity as a parameter representative of complicacy of the VLC and outputs the complexity to a complexity buffer section 45.
The complexity buffer section 45 temporarily stores the complexity inputted from the complexity arithmetic operation section 46 and suitably outputs the complexity to a target code amount arithmetic operation section 41.
The target code amount arithmetic operation section 41 calculates a target code amount based on the complexity inputted from the complexity buffer section 45 and outputs the target code amount to a quantization index arithmetic operation section 42.
The quantization index arithmetic operation section 42 calculates a quantization index based on the target code amount inputted from the target code amount arithmetic operation section 41 and outputs the quantization index to a quantization scale arithmetic operation section 43.
An activity arithmetic operation section 44 calculates an activity as a parameter representative of complicacy of data of each of the MBs inputted from the macro block division section 11 and outputs the activity to the quantization scale arithmetic operation section 43.
The quantization scale arithmetic operation section 43 calculates a quantization scale based on the quantization index inputted from the quantization index arithmetic operation section 42 and the activity inputted from the activity arithmetic operation section 44 and outputs the quantization scale to the quantization section 13.
Subsequently, operation of the image coding apparatus 1 is described.
Frame data are inputted to the macro block division section 11 and converted into data in a unit of an MB and then outputted to the subtraction section 19.
Reference image data inputted from the reference image production section 17 to the subtraction section 19 are subtracted from the data of the MB inputted to the subtraction section 19, and data of the difference between them is outputted to the DCT section 12.
The difference data inputted to the DCT section 12 is converted into a DCT coefficient, and the DCT coefficient is outputted to the quantization section 13. The DCT coefficient inputted to the quantization section 13 is quantized based on a quantization scale inputted from the quantization scale arithmetic operation section 43 to the quantization section 13 and then inputted to the VLC section 14.
The quantized data inputted to the VLC section 14 is converted into a VLC, and the VLC is outputted to the transmission buffer section 15.
The VLC inputted to the transmission buffer section 15 is outputted to the complexity arithmetic operation section 46. When VLCs of the entire frame are inputted to the transmission buffer section 15, the VLCs are converted into data in a unit of a frame, and the data are outputted as bit stream data to the outside.
The quantized data inputted from the quantization section 13 to the dequantization section 21 is dequantized and outputted to the inverse DCT section 22. The dequantized data inputted to the inverse DCT section 22 is converted back into original image data, and the original image data is outputted to the addition section 34.
The image data inputted to the addition section 34 is added to the reference image data (that is, the reference image data obtained by the subtraction from the data of the MB by the subtraction section 19) stored in the motion compensation buffer section 31 in advance and then decoded.
The decoded data of the MB is inputted to the motion compensation buffer section 31 through the motion compensation section 32 and stored as predictive image data of an MB of a frame to be processed subsequently.
The motion detection arithmetic operation section 33 detects a motion vector corresponding to the data of the MB inputted from the macro block division section 11 and outputs the motion vector to the motion compensation section 32.
By the motion compensation section 32, a process of motion compensation corresponding to the motion vector inputted from the motion detection arithmetic operation section 33 is performed. In particular, from within the predictive image data stored in advance in the motion compensation buffer section 31, the predictive image data at a position displaced by an amount corresponding to the motion vector from the position of the MB is read out, and the predictive image data is outputted as reference image data for the MB to the subtraction section 19.
The quantization scale determination section 18 performs the following three process, that is, so-called TM5 (Test Model 5) processes of the MPEG to calculate a quantization scale of the MB and outputs the quantization scale of the MB to the quantization section 13.
(Step 1)
The target code amount arithmetic operation section 41 calculates, based on the value of the complexity of the VLC of the MB inputted from the complexity buffer section 45 and processed at the k-th (the MB processed at the k−1th is hereinafter referred to as MB-k−1), a target code amount for the MB-k, and outputs the target code amount to the quantization index arithmetic operation section 42.
(Step 2)
The quantization index arithmetic operation section 42 calculates a virtual buffer occupation amount of the MB-k, based on the target code amount for the MB-k inputted from the target code amount arithmetic operation section 41.
Further, the quantization index arithmetic operation section 42 calculates a quantization index of the MB-k based on the virtual buffer occupation amount of the MB-k and outputs the quantization index of the MB-k to the quantization scale arithmetic operation section 43.
(Step 3)
The quantization scale arithmetic operation section 43 calculates a quantization scale, based on the quantization index of the MB-k inputted from the quantization index arithmetic operation section 42 and the value of the activity of the MB-k inputted from the activity arithmetic operation section 44, and outputs the quantization scale to the quantization section 13.
Incidentally, it is known that the degree of the distribution of the information amount in a frame to be coded has a relationship to the visual perceptibility of the frame, that is, the picture quality.
However, the image coding apparatus 1 calculates the quantization scales of the MBs without referring to the distribution of the information amount of the frame and uses the calculated quantization scales to quantize the individual MBs.
For example, when the MB-k is quantized based on the quantization scale of the MB-k, the quantization scale of the MB-k (the quantization scale is hereinafter referred to as MQUANT-k) is calculated at the (step 3) of the TM5 in accordance with the following expression (1):MQUANT-k=(2×activity-k+avgact)/(activity-k+2×avgact)×Q-k  (1)
activity-k represents the activity of the MB-k, and avgact represents the average value of the activities in the frame. Further, Q-k represents the quantization index of the MB-k.
In particular, the image coding apparatus 1 multiplies the quantization index by a coefficient having a fixed amplitude (in the example of the expression (1), “(2×activity-k+avgact)/(activity-k+2×avgact)” which ranges from 0.5 to 2) to calculate the quantization scale without depending upon the distribution of the information amount of the frame.
It is to be noted that the “coefficient by which the quantization index is multiplied in order to calculate the quantization scale” is hereinafter referred to as “coefficient of the quantization index” and the “range in which the quantization index can vary” is hereinafter referred to as “range of the quantization index”.
For example, in the expression (1) given hereinabove, the “coefficient of the quantization index” is “(2×activity-k+avgact)/(activity-k+2×avgact),” and the “range of the quantization index” is “0.5 to 2”.
As a result, there is a problem that the visual perceptibility of a frame coded by the image coding apparatus 1 is degraded.